package com.java.demo16;

public class Test01 {
    public static void main(String[] args) {

//        Animal dog = new Dog();
//        dog.eat();

        //匿名内部类
        Animal dog = new Animal() {
            @Override
            public void eat() {
                System.out.println("匿名内部类,Dog eats");
            }
        };
        dog.eat();

        Animal cat = new Animal() {
            @Override
            public void eat() {
                System.out.println("匿名内部类,Cat eats");
            }
        };
        cat.eat();
    }
}
